<%@ page import="edu.zut.pojo.SysUser" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--引用jstl--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%--在个人中心中，展示用户信息，用户头像，
如果用户没有上传头像，就使用默认头像，如果有，就使用上传的
--%>
<%
    request.setAttribute("imgUrl","");

%>
<%--if判断--%>
<c:if test="${empty imgUrl}">
    <img height="30%" width="30%" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Ffile02.16sucai.com%2Fd%2Ffile%2F2014%2F0704%2Fe53c868ee9e8e7b28c424b56afe2066d.jpg&refer=http%3A%2F%2Ffile02.16sucai.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1637739027&t=16d92ad052c5e291db6a53d99eb26be8">
</c:if>
<c:if test="${!empty imgUrl}">
    <img src="${imgUrl}" height="30%" width="30%">
</c:if>

<%
    SysUser sysUser = new SysUser(1, "jack", 20);
    SysUser sysUser2 = new SysUser(2, "tom", 21);
    List<SysUser> list = new ArrayList<>();
    list.add(sysUser);
    list.add(sysUser2);
    request.setAttribute("list",list);
    for(SysUser user :list){

    }
%>

<%--保存的数据集合
c:forEach:遍历   items:遍历的集合    var:遍历的结果或者是key(map) varStatus:遍历的状态
step:步幅 默认是1   begin：从哪个下标开始  end：到哪个结束
--%>
<table border="1" cellspacing="0" cellpadding="0">
    <c:forEach var="user" varStatus="status" step="1"
               end="${list.size()}" begin="0" items="${list}">
        <tr>
            <td>id：${user.id}</td>
            <td>name：${user.name}</td>
            <td>age：${user.age}</td>
        </tr>
    </c:forEach>
</table>

<%--url标签--%>
<c:url var="url" value="http://www.baidu.com" scope="application"></c:url>
<a href="${url}">Baidu</a>

<form action="${pageContext.request.contextPath}/test" method="get">
    <input type="submit">
</form>
</body>
</html>
